package com.xiaohu.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;

/*
    flink1.12版本【包括】之前，是调用一个叫做addSource()方法添加数据源
    flink1.13版本开始，主要使用的是批流一体的api，新的Source架构，提供了很多常见的Source方法


 */

public class FromCollectionSourceDemo {
    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //写法1
//        DataStreamSource<Integer> source = env.fromCollection(Arrays.asList(1, 22, 3));
        //写法2
        DataStreamSource<Integer> source = env.fromElements(11, 22, 33, 44);


        source.print();



        env.execute();
    }
}
